package xyz.ieden.jpa.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.ieden.jpa.entity.User;
import xyz.ieden.jpa.repository.UserRepository;
import xyz.ieden.jpa.service.IUserService;

import java.util.List;
import java.util.Optional;

/**
 * Created by Gavin on 2017.08.05.
 */
@Service
public class UserServiceImpl implements IUserService{

    @Autowired
    private Optional<UserRepository> userRepository;

    @Override
    public void deleteAll() {

    }

    @Override
    public void deleteByUsers(List<User> userList) {

    }

    @Override
    public void deleteByUser(User user) {

    }

    @Override
    public void deleteById(Integer id) {

    }

    @Override
    public Long countById() {
        return null;
    }

    @Override
    public List<User> findAll(List<Integer> idList) {
        return null;
    }

    @Override
    public List<User> findAll() {
        return null;
    }

    @Override
    public Boolean exists(User user) {
        return null;
    }

    @Override
    public User findOneById(Integer id) {
        return userRepository.get().findOne(id);
    }

    @Override
    public List<User> saveUsers(List<User> userList) {
        return null;
    }

    @Override
    public User save(User user) {
        if (userRepository.isPresent()) {
            return userRepository.get().save(user);
        } else {
            return null;
        }
    }
}
